﻿using System;
using System.Diagnostics;
using System.Linq;

namespace Affinity.Core.Exceptions
{
    public static class ThrowHelper
    {
        public static void Throw(Exception exception, int skipStackFrames)
        {
            throw new ExceptionWrapper(
                new ExceptionWrapper.Parameters
                {
                    // The StackTrace constructor accepting the number of frames to skip is SecurityCritical.
                    //StackTrace = string.Join(Environment.NewLine, new StackTrace().GetFrames().Skip(skipStackFrames + 1)),
                    WrappedException = exception
                });
        }
    }
}
